import { $baseApi } from "@/utils/http-instance"
import useCommonStore from "@/store/common"
import type { Params } from "@/types/common"

const commonStore = useCommonStore()

// 文章详情
export const $getArticleDetail = (id: string) => $baseApi.get(`es-articles/get-for-member/${id}`)

// 文章列表
export const $getArticleList = (params: Params) =>
	$baseApi.get(`regions/${commonStore.region_id}/es-articles/list-for-member`, params)

// 文章分组标签
export const $getArticleTags = () =>
	$baseApi.get(`regions/${commonStore.region_id}/article-tag-groups/list-all-enabled-with-tags`)

// 文章点赞
export const $articleFavorite = (id: string) => $baseApi.post(`es-articles/like/${id}`)

// 文章取消点赞
export const $articleCancelFavorite = (id: string) => $baseApi.post(`es-articles/cancel-like/${id}`)
